Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.10 Fix jump offsets opcodes #22940

Closed
wants to merge 4 commits into from

Conversation

yeandy
Copy link
Contributor

@yeandy yeandy commented Aug 29, 2022

Fixes #21671

The issue was caused by a deliberate change in behavior in Python 3.10 due to bpo-27129. The offsets were originally byte (8 bits) offsets in Python 3.9, but instruction (16 bits) offsets in Python 3.10. The opcode numbers were halved, so to compensate, I had to double them again when reading it.

A few other tests were failing too. I had to add an opcode due to bpo-43683 in which a new bytecode GEN_START was added.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@codecov
Copy link

codecov bot commented Aug 29, 2022

Codecov Report

Merging #22940 (830aaa3) into master (e880fdb) will increase coverage by 0.01%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##           master   #22940      +/-   ##
==========================================
+ Coverage   73.90%   73.91%   +0.01%     
==========================================
  Files         713      714       +1     
  Lines       94464    94671     +207     
==========================================
+ Hits        69809    69975     +166     
- Misses      23358    23399      +41     
  Partials     1297     1297              
Flag Coverage Δ
python 83.50% <80.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdks/python/apache_beam/typehints/opcodes.py 84.64% <50.00%> (-0.25%) ⬇️
.../python/apache_beam/typehints/trivial_inference.py 96.15% <87.50%> (-0.27%) ⬇️
sdks/python/apache_beam/typehints/__init__.py 77.77% <0.00%> (-22.23%) ⬇️
.../python/apache_beam/testing/test_stream_service.py 88.09% <0.00%> (-4.77%) ⬇️
.../python/apache_beam/transforms/periodicsequence.py 98.38% <0.00%> (-1.62%) ⬇️
...che_beam/runners/interactive/interactive_runner.py 90.06% <0.00%> (-1.33%) ⬇️
sdks/python/apache_beam/dataframe/schemas.py 96.62% <0.00%> (-1.05%) ⬇️
sdks/python/apache_beam/transforms/combiners.py 93.05% <0.00%> (-0.39%) ⬇️
sdks/python/apache_beam/typehints/schemas.py 93.84% <0.00%> (-0.31%) ⬇️
...s/python/apache_beam/examples/wordcount_minimal.py 92.59% <0.00%> (-0.27%) ⬇️
... and 14 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@yeandy
Copy link
Contributor Author

yeandy commented Aug 30, 2022

R: @robertwb

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

@yeandy
Copy link
Contributor Author

yeandy commented Sep 1, 2022

retest this please

@yeandy
Copy link
Contributor Author

yeandy commented Sep 1, 2022

R: @AnandInguva

# Python 3.10: bpo-27129 changes jump offsets to use instruction offsets,
# not byte offsets. The offsets were halved (16 bits fro instructions vs 8
# bits for bytes), so we have to double the value of arg.
if (sys.version_info.major, sys.version_info.minor) == (3, 10):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use the 2 multiplier for all minor versions >= 10 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll change it. When I wrote == (3, 10), I was thinking of GEN_START which was added in 3.10, but then removed in 3.11.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@yeandy
Copy link
Contributor Author

yeandy commented Sep 8, 2022

Merged into the 3.10 feature branch #22995

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 6, 2022
@tvalentyn tvalentyn closed this Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in type inference for Python 3.10
2 participants